package com.bestv.search.common.service.impl;

import com.bestv.search.common.dao.InfoHeaderItemDao;
import com.bestv.search.common.dataSource.DataSourceKey;
import com.bestv.search.common.model.InfoHeaderItem;
import com.bestv.search.common.service.InfoHeaderItemManager;

import java.util.List;

public class InfoHeaderItemManagerImpl implements InfoHeaderItemManager {

    private InfoHeaderItemDao infoHeaderItemDao;

    public void saveOrUpdate(DataSourceKey key, InfoHeaderItem infoMapping) {
        infoHeaderItemDao.saveOrUpdate(infoMapping);
    }

    public void saveOrUpdate(DataSourceKey key, List<InfoHeaderItem> infosMapping) {
        for (InfoHeaderItem infoMapping : infosMapping) {
            infoHeaderItemDao.saveOrUpdate(infoMapping);
        }
    }

    public InfoHeaderItem get(DataSourceKey key, long headerId, long infoId) {
        return infoHeaderItemDao.get(headerId, infoId);
    }

    public List<InfoHeaderItem> getInfoHeaderItemByHeaderId(DataSourceKey key, long headerId) {
        return infoHeaderItemDao.getInfoHeaderItemByHeaderId(headerId);
    }

    public List<InfoHeaderItem> getOnlineInfoHeaderItemByInfoId(DataSourceKey key, long infoId) {
        return infoHeaderItemDao.getOnlineInfoHeaderItemByInfoId(infoId);
    }

    public List<InfoHeaderItem> getAllInfoHeaderItemByInfoId(DataSourceKey key, long infoId) {
        return infoHeaderItemDao.getOnlineInfoHeaderItemByInfoId(infoId);
    }

    public void removeInfoItems(DataSourceKey key, List<InfoHeaderItem> list) {
        infoHeaderItemDao.removeObjectList(list);
    }

    public InfoHeaderItemDao getInfoHeaderItemDao() {
        return infoHeaderItemDao;
    }

    public void setInfoHeaderItemDao(InfoHeaderItemDao infoHeaderItemDao) {
        this.infoHeaderItemDao = infoHeaderItemDao;
    }

}